package cn.cmcc.online.smsapi.ui.presenter;

import android.content.Context;
import android.view.View;

import org.json.JSONObject;

import cn.cmcc.online.smsapi.ui.model.EmailData;

/**
 * Created by ZhangYifan on 2017/6/17.
 */

public class EmailPresenterImpl extends EmailPresenter {
    private EmailData mData;

    public EmailPresenterImpl() {
    }

    @Override
    public void bind(JSONObject data) {
        super.bind(data);

        mData = new EmailData(data);

        String sender = mData.getHighInfoValue();
        String emailContent = mData.getMainInfoData();
        String activitiesInfo = mData.getExtraInfoTip();

        vista.setSender("发件人："+sender);

        if (emailContent != null && emailContent.length() > 0) {
            vista.setEmailContentVisible(View.VISIBLE);
            vista.setEmailContent(emailContent);
        } else {
            vista.setEmailContentVisible(View.GONE);
        }

        if (activitiesInfo != null && activitiesInfo.length() > 0) {
            vista.setTipInfoVisible(View.VISIBLE);
            vista.setTipInfo(activitiesInfo);
        } else {
            vista.setTipInfoVisible(View.GONE);
        }
    }
}
